home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>FreeFile Function[Runtime]</title><meta name="filename" content="text/sbasic/common/03020102"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } </style></head><body> <help:paragraphinfo state="E" xmlns:help="http://openoffice.org/2000/help"/><help:to-be-embedded Eid="freefile" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:paragraphinfo state="U" number="1"/><help:key-word value="FreeFile; function" tag="kw66512_1"/><help:link Id="66512">FreeFile Function[Runtime]</help:link></p> <p class="Paragraph"><help:paragraphinfo state="U" number="2"/>Returns the next available file number for opening a file. Use this function to open a file using a file number that is not already in use by a currently open file.</p> <help:paragraphinfo state="E"/></help:to-be-embedded> <p class="Head2"><help:paragraphinfo state="U" number="3" xmlns:help="http://openoffice.org/2000/help"/>Syntax:</p> <p class="Paragraph"><help:paragraphinfo state="U" number="4" xmlns:help="http://openoffice.org/2000/help"/>FreeFile</p> <p class="Head2"><help:paragraphinfo state="U" number="5" xmlns:help="http://openoffice.org/2000/help"/>Return value:</p> <p class="Paragraph"><help:paragraphinfo state="U" number="6" xmlns:help="http://openoffice.org/2000/help"/>Integer</p> <p class="Head2"><help:paragraphinfo state="U" number="7" xmlns:help="http://openoffice.org/2000/help"/>Parameters:</p> <p class="Paragraph"><help:paragraphinfo state="U" number="8" xmlns:help="http://openoffice.org/2000/help"/>This function can only be used immediately in front of an Open statement. FreeFile returns the next available file number, but does not reserve it.</p> <p class="Paragraph"><help:paragraphinfo state="S" xmlns:help="http://openoffice.org/2000/help"/><help:embedded Id="66475" Eid="errorcode" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><help:paragraphinfo state="S" xmlns:help="http://openoffice.org/2000/help"/><help:embedded Id="66475" Eid="err5" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><help:paragraphinfo state="S" xmlns:help="http://openoffice.org/2000/help"/><help:embedded Id="66475" Eid="err67" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Head2"><help:paragraphinfo state="U" number="9" xmlns:help="http://openoffice.org/2000/help"/>Example:</p> <p class="PropText"><help:paragraphinfo state="U" number="10" xmlns:help="http://openoffice.org/2000/help"/>Sub ExampleWorkWithAFile</p> <p class="PropText"><help:paragraphinfo state="U" number="11" xmlns:help="http://openoffice.org/2000/help"/>Dim iNumber As Integer</p> <p class="PropText"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/>Dim sLine As String</p> <p class="PropText"><help:paragraphinfo state="U" number="13" xmlns:help="http://openoffice.org/2000/help"/>Dim aFile As String</p> <p class="PropText"><help:paragraphinfo state="U" number="36" xmlns:help="http://openoffice.org/2000/help"/>Dim sMsg as String</p> <p class="PropText"><help:paragraphinfo state="U" number="14" xmlns:help="http://openoffice.org/2000/help"/>aFile = "c:\data.txt"</p> <p class="PropText"><help:paragraphinfo state="U" number="15" xmlns:help="http://openoffice.org/2000/help"/>sMsg = = ""</p> <p class="PropText"><help:paragraphinfo state="U" number="16" xmlns:help="http://openoffice.org/2000/help"/>iNumber = Freefile</p> <p class="PropText"><help:paragraphinfo state="U" number="17" xmlns:help="http://openoffice.org/2000/help"/>Open aFile For Output As #iNumber</p> <p class="PropText"><help:paragraphinfo state="U" number="18" xmlns:help="http://openoffice.org/2000/help"/>Print #iNumber, "First line of text"</p> <p class="PropText"><help:paragraphinfo state="U" number="19" xmlns:help="http://openoffice.org/2000/help"/>Print #iNumber, "Another line of text"</p> <p class="PropText"><help:paragraphinfo state="U" number="20" xmlns:help="http://openoffice.org/2000/help"/>Close #iNumber</p> <p class="PropText"><help:paragraphinfo state="U" number="21" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="PropText"><help:paragraphinfo state="U" number="24" xmlns:help="http://openoffice.org/2000/help"/>iNumber = Freefile</p> <p class="PropText"><help:paragraphinfo state="U" number="25" xmlns:help="http://openoffice.org/2000/help"/>Open aFile For Input As #iNumber</p> <p class="PropText"><help:paragraphinfo state="U" number="26" xmlns:help="http://openoffice.org/2000/help"/>While not eof(#iNumber)</p> <p class="PropText"><help:paragraphinfo state="U" number="27" xmlns:help="http://openoffice.org/2000/help"/>Line Input #iNumber, sLine</p> <p class="PropText"><help:paragraphinfo state="U" number="28" xmlns:help="http://openoffice.org/2000/help"/>If sLine <>"" then</p> <p class="PropText"><help:paragraphinfo state="U" number="29" xmlns:help="http://openoffice.org/2000/help"/>sMsg = sMsg & sLine & chr(13)</p> <p class="PropText"><help:paragraphinfo state="U" number="31" xmlns:help="http://openoffice.org/2000/help"/>end if</p> <p class="PropText"><help:paragraphinfo state="U" number="32" xmlns:help="http://openoffice.org/2000/help"/>wend</p> <p class="PropText"><help:paragraphinfo state="U" number="33" xmlns:help="http://openoffice.org/2000/help"/>Close #iNumber</p> <p class="PropText"><help:paragraphinfo state="U" number="37" xmlns:help="http://openoffice.org/2000/help"/>Msgbox sMsg</p> <p class="PropText"><help:paragraphinfo state="U" number="34" xmlns:help="http://openoffice.org/2000/help"/>End Sub</p> <p class="PropText"><help:paragraphinfo state="U" number="35" xmlns:help="http://openoffice.org/2000/help"/></p> </body></html>